//
//  MyTabBarViewController.m
//  CreativeLife
//
//  Created by qianfeng on 15-6-11.
//  Copyright (c) 2015年 qianfeng. All rights reserved.
//

#import "MyTabBarViewController.h"
#import "BaseViewController.h"

@interface MyTabBarViewController ()

@end

@implementation MyTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatControllerView];

}

-(void)creatControllerView{
    NSString *path=[[NSBundle mainBundle]pathForResource:@"CreativeLife" ofType:@"plist"];
    NSArray *arr=[NSArray arrayWithContentsOfFile:path];
    NSMutableArray *vcArr=[[NSMutableArray alloc]init];
    NSArray *urlArr=@[kChuangYiUrl,kSuiYiChuanYueUrl,kQuWeiUrl,@""];
    NSArray *typeArr=@[kChuangYiType,kSuiJiChuanYueType,kQuWeiType,kGengDuoType];
    
    for (NSInteger i=0; i<arr.count; i++) {
        NSDictionary *dict=arr[i];
        Class vcClass=NSClassFromString(dict[@"vcName"]);
        
        BaseViewController *vc=[[vcClass alloc]init];
        UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];
        vc.resquestUrl=urlArr[i];
        vc.category=typeArr[i];
        nav.tabBarItem.title=dict[@"title"];
        UIImageView *view=[[UIImageView alloc]initWithFrame:CGRectMake(kScreenSize.width/2-50, 0, 100, 25)];
        view.image=[UIImage imageNamed:dict[@"topTitle"]];
         vc.navigationItem.titleView=view;
        [nav.navigationBar setBackgroundImage:[UIImage imageNamed: @"nav_bg"] forBarMetrics:UIBarMetricsDefault];
        
        nav.tabBarItem.image=[[UIImage imageNamed:dict[@"image"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        nav.tabBarItem.selectedImage=[[UIImage imageNamed:dict[@"selectImage"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        [vcArr addObject:nav];
    }
    self.viewControllers=vcArr;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
